package com.yq.ylmall.client.product;

import com.yq.ylmall.client.product.fallback.ProductFeignFallback;
import com.yq.ylmall.dto.product.ProductDecreaseDto;
import com.yq.ylmall.vo.product.ProductInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(url = "http://localhost:8500", value = "ylmall-service-product", fallback = ProductFeignFallback.class)
public interface ProductFeignClient {

    @GetMapping("/api/product/get/{id}")
    ProductInfoVo getById(@PathVariable("id") Long id);

    @PostMapping("/api/product/decrease")
    void decreaseStock(@RequestBody ProductDecreaseDto productDecrease);

    @GetMapping("/api/product/category/index")
    String indexCategory();

    @GetMapping("/api/product/banner")
    String indexBanner();

}
